//package leetcode;
//
//import java.util.Arrays;
//
//public class Test2 {
////    private static int[] forCopyArray(int[] arr) {
////        int[] newArray = new int[arr.length];
////        for (int i = 0; i < newArray.length; i++) {
////            newArray[i] = arr[i];
////        }
////        return newArray;
////    }
////
////    public static void main(String[] args) {
////        int[] arr = {1, 2, 3, 4, 5, 6};
////        int[] ret = forCopyArray(arr);
////        System.out.println("原数组： ");
////        for (int i : arr) {
////            System.out.print(i + " ");
////        }
////        System.out.println();
////        System.out.println("拷贝数组： ");
////        for (int i : ret) {
////            System.out.print(i + " ");
////        }
////        System.out.println();
////        System.out.println("这种拷贝方式是深拷贝");
////    }
//
////    public static void main(String[] args) {
////        int[] arr = {1, 2, 3, 4, 5, 6};
////        int[] ret = Arrays.copyOf(arr, arr.length);
////        System.out.println("原数组： ");
////        for (int i : arr) {
////            System.out.print(i + " ");
////        }
////        System.out.println();
////        System.out.println("拷贝数组： ");
////        for (int i : ret) {
////            System.out.print(i + " ");
////        }
////    }
//
//    //    public static void main(String[] args) {
////        int[] arr = {1, 2, 3, 4, 5, 6};
////        int[] ret = new int[arr.length];
////        System.arraycopy(arr, 0, ret, 0, arr.length);
////        System.out.println("原数组： ");
////        for (int i : arr) {
////            System.out.print(i + " ");
////        }
////        System.out.println();
////        System.out.println("拷贝数组： ");
////        for (int i : ret) {
////            System.out.print(i + " ");
////        }
////    }
////    public static void main(String[] args) {
////        int[] arr = {1, 2, 3, 4, 5, 6};
////        int[] ret = arr.clone();
////        System.out.println("原数组： ");
////        for (int i : arr) {
////            System.out.print(i + " ");
////        }
////        System.out.println();
////        System.out.println("拷贝数组： ");
////        for (int i : ret) {
////            System.out.print(i + " ");
////        }
////    }
//
//    public static void main(String[] args) throws CloneNotSupportedException {
//        Student zhangsan_stu = new Student();
//        zhangsan_stu.setName("张三");
//
//        Teacher wang_teacher = new Teacher();
//        wang_teacher.setName("王");
//        wang_teacher.setStudent(zhangsan_stu);
//
//        System.out.println(zhangsan_stu);
//        System.out.println(wang_teacher);
////        Student{name='张三'}
////        Teacher{name='王', student=Student{name='张三'}}
//
//        Teacher zhao_teacher = new Teacher();
//        zhao_teacher = (Teacher) wang_teacher.clone();
//        System.out.println(zhao_teacher);
////        赵老师拷贝王老师
////        Teacher{name='王', student=Student{name='张三'}}
//        zhao_teacher.setName("赵");
//        zhao_teacher.getStudent().setName("李四");
//        System.out.println(wang_teacher);
//        System.out.println(zhao_teacher);
////        Teacher{name='王', student=Student{name='李四'}} 原始数据被修改成了李四，证明是浅拷贝
////        Teacher{name='赵', student=Student{name='李四'}}
//    }
//}
